package zjut.cocouml.figure;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;

public class BInterfaceFigure extends Figure{
	
	private LabelName labelName = new LabelName();
	
	private CompartmentFigure methodArea = new CompartmentFigure();
	private CompartmentFigure attriArea = new CompartmentFigure();
	
	public static final int BCLASS_FIGURE_DEFWIDTH = 250;
	public static final int BCLASS_FIGURE_DEFHEIGHT = 150;
	
	public BInterfaceFigure() {
		
		ToolbarLayout layout = new ToolbarLayout();
		this.setLayoutManager(layout);
		this.setBorder(new LineBorder(ColorConstants.black,1));
		this.setBackgroundColor(new Color(null,255,155,206));
		this.setOpaque(true);
		
		this.add(labelName);
		this.add(attriArea);
		this.add(methodArea);
	}
	
	public CompartmentFigure getMethodArea() {
		return methodArea;
	}
	public void setLabelName(LabelName labelName) {
		this.labelName = labelName;
	}
	public void setMethodArea(CompartmentFigure methodArea) {
		this.methodArea = methodArea;
	}
	public void setLabelName(String name) {
		this.labelName.setName(name);
	}
	public String getLabelName() {
		return this.labelName.getName();
	}
	public void setLayout(Rectangle rect) {
		getParent().setConstraint(this, rect);
	}
	public CompartmentFigure getAttriArea() {
		return attriArea;
	}
	public void setAttriArea(CompartmentFigure attriArea) {
		this.attriArea = attriArea;
	}
}
